package com.nvwa.stater.logback.preparam;

import com.nvwa.coding.util.safe.Coding;

import java.util.Map;
import java.util.StringJoiner;

public class PreparamUtil {
    public static final String PRE_PARAM = "preParam";

    public static String convertToStr(Map<String, String> preParamMap) {
        if (Coding.isEmpty(preParamMap)) {
            return "";
        }
        StringJoiner joiner = new StringJoiner(",", "[", "]");

        for (Map.Entry<String, String> entry : preParamMap.entrySet()) {
            joiner.add(entry.getKey() + ":" + entry.getValue());
        }
        return joiner.toString();
    }
}
